<!--赚钱分享社区-->
<template>

	<view class="share_page clearfix">
		<!-- <uni-top2 fixed="true" statusBar="true" class="top" border="" background-color="#585cf7" color="#fff"  
			left-icon="back" title="赚钱分享社区" @clickLeft="goToIndex">
		</uni-top2> -->
		<view class="sh_page">
			<view class="sh_banner">
				<view class="img_wrap">
					<image class="img" src="../../static/image/page/share.png" mode="aspectFill"></image>
					<view class="top_con">
						<view class="t1">总分享佣金(元)</view>
						<view class="t2">￥123,123,456</view>
						<view class="t3">已有1222名经纪人赚钱</view>
					</view>
				</view>
			</view>
		</view>
		<!--end sh_page-->
		<view class="share_list">
			<view class="item" v-for="(item, index) in list" :key="item.id" >
				 <view class="user-info-box flex-align ">
					<image class="user-img" :src="item.appIcon" ></image>
	
				    <view class="user-info">
				      <text class="user-name">{{item.releaseName}}</text>
				      <text class="user-level">{{item.classify}}</text>
				    </view>
				  </view>
				<view class="title com_title sq-title">
					{{item.releaseTitle}}
				</view>
				<view class="intro com_text sq-content">
					{{item.releaseContent}}
				</view>
				 <view class="sl-text" >... <text class="sl-quanwen" @click="goToRev(item.id)">全文</text> </view>
				<view class="bottom">
					<view class="b_l">
						<text class="uniicons">&#xe824;</text>
						<text>{{item.browseNum}}</text>
						<text class="uniicons">&#xe263;</text>
						<text>{{item.commentNum}}</text>
					</view>
					<view class="b_r">
						{{item.front}}
					</view>
				</view>
			</view>
		</view>

		<view class="release" @click="addForun">
			<image class="img" src="../../static/image/page/release.png" mode="aspectFit"></image>
		</view>

		<uni-load-more :status="status" v-if="pages > 1" />
	</view>
</template>

<script>
	import {
		mapGetters
	} from 'vuex';
	import baseURL from "@/common/config.js"
	export default {
		computed: {
			...mapGetters(["hasLogin"]),
		},
		data() {
			return {
				list: [],
				pages: 1,
				pageNum: 0,
				status: 'more',
			};
		},
		onShow() {
			this.getForumList();
		},
		onReachBottom: function() {
			if (!this.hasLogin) return;
			let that = this;
			let pageNum = this.pageNum + 1;
			if (pageNum <= this.pages) {
				let queryData = {};
				queryData.pageNo = pageNum;
				that.getMoreData(queryData)
			} else {
				that.status = "noMore"
			}
		},
		methods: {
			//查看详情
			goToRev(id) {
				uni.navigateTo({
					url: "/pages/shareCom/revForum?id=" + id,
				})
			},
			//上拉刷新
			onPullDownRefresh() {
				if (!this.hasLogin) {
					setTimeout(function() {
						uni.stopPullDownRefresh();
					}, 1000);
					return;
				}
				let that = this;
				that.$api.getForumList({
					pageNo: 1
				}).then(res => {
					that.list = res.data.data.records;
					that.pages = res.data.data.pages;
					that.pageNum = res.data.data.current
					setTimeout(function() {
						uni.stopPullDownRefresh();
					}, 1000);
				}).catch(() => {
					setTimeout(function() {
						uni.stopPullDownRefresh();
					}, 1000);
				})
			},
			//获取列表
			getForumList() {
				this.$api.getForumList({
					pageNo: 1
				}).then(res => {
					this.list = res.data.data.records;
					this.pages = res.data.data.pages;
					this.pageNum = res.data.data.current
				})
			},
			//获取更多订单
			getMoreData(reQuery) {
				this.$api.getForumList(reQuery).then(res => {
					let data = res.data.data.records;
					if (data) {
						this.list = this.list.concat(data);
						this.pages = res.data.data.pages;
						this.pageNum = res.data.data.current;
					}
				})
			},
			//添加
			addForun() {
				uni.navigateTo({
					url: "/pages/shareCom/addForum"
				})
			},
			//返回首页
			goToIndex() {
				uni.switchTab({
					url: "/pages/index/index"
				})
			}
		}
	}
</script>
<style>
	page {
		background: #F8F8F8;
		padding-bottom: 20px;
	}
</style>
<style lang="scss">
	.sh_page {
		background: $dtg-color-primary;

		.sh_banner {
			border-radius: 20rpx 20rpx 0 0;
			overflow: hidden;
			background: #F8F8F8;
			padding: 30rpx;

			.img_wrap {
				width: 100%;
				height: 180rpx;
				position: relative;

				.img {
					width: 100%;
					height: 100%;
				}

				.top_con {
					position: absolute;
					top: 0;
					left: 0;
					z-index: 800;
					color: #FFFFFF;
					padding: 30rpx 40rpx;

					.t1 {
						font-size: 22rpx;
					}

					.t2 {
						font-size: 42rpx;
						font-weight: bold;
						padding-left: 40rpx;
					}

					.t3 {
						font-size: 22rpx;
						padding-left: 40rpx;
					}
				}
			}
		}
	}

	.share_list {
		padding: 0 30rpx;

		.item {
			background: #FFFFFF;
			border-radius: 20rpx;
			padding: 20rpx;
			margin-bottom: 20rpx;

			.sq-title {
				text-overflow: -o-ellipsis-lastline;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 1;
				line-clamp: 1;
				-webkit-box-orient: vertical;
				max-width: 100%;
				word-wrap: break-word
			}
			.sq-content{
				max-height: 50px;
				overflow: hidden;
				font-size: 30rpx;
			}
			.sl-text{
			  font-size: 30rpx;
			  color: #333333;
			}
			.sl-quanwen{
			  color: #585CF7;
			}
			.user-info-box{
			  margin-bottom: 20rpx;
			}
			.user-info{
			  display: flex;
			  /* align-items: center; */
			  justify-content: space-between;
			  flex-direction: column;
			  height: 70rpx;
			}
			.user-name{
			  font-size: 30rpx;
			font-weight: 800;
			color: #333333;
			}
			.user-level{
			  font-size: 22rpx;
			color: #999999;
			}
			.user-img{
			  width: 70rpx;
			  height: 70rpx;
			  margin-right: 20rpx;
			  border-radius: 50%;
			}

			.intro {
				color: #666666;
				margin-top: 10rpx;
			}

			.bottom {
				height: 40rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				color: #999999;
				font-size: 22rpx;

				.b_l text {
					margin-right: 10rpx;
				}
			}
		}
	}

	.release {
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
		position: fixed;
		bottom: 100rpx;
		right: 30rpx;

		.img {
			width: 100%;
			height: 100%;
		}
	}
</style>
